package com.sanpang.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sanpang.common.pojo.EasyUIDataGridResult;
import com.sanpang.pojo.TbItem;
import com.sanpang.service.ItemService;

/**
 * 
 * 商品管理Controller
 * <p>Title: ItemController</p>
 * <p>Description: </p>
 * @version 1.0
 * 
 * @author sanpang
 *
 */
@Controller
public class ItemController {
	@Autowired
	private ItemService itemService;
	
	
	@RequestMapping("/item/{itemId}")
	@ResponseBody// 如果没有引入jackson包 报406 错误
	private TbItem getItemById(@PathVariable("itemId") Long itemId) {
		//根据商品Id查询商品信息
		TbItem tbItem = itemService.getItemById(itemId);
		//返回数据 的结   啊啊啊果  xxx

		return tbItem;
	}
	
	@RequestMapping("/item/list")
	@ResponseBody
	public EasyUIDataGridResult getIteamList(Integer page,Integer rows){
		
		 EasyUIDataGridResult result =itemService.getIteamList(page, rows);
		 
		 return result;
		
	}

}
